﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ProjectRoughWork
{
    class CProcess
    {
        /// <summary>
        /// Defaults constructor. Initializes all the data members of the class
        /// </summary>

        public CProcess()
        {
            active = true;
            paused = false;
            dead = false;
            next = null;
        }

        /// <summary>
        /// A method that handles any special instructions necessary for when a process is killed
        /// </summary>

        public void VKill()
        {
        }

        /// <summary>
        /// A method that determines whether the current process is active
        /// </summary>
        /// <returns>Returns whether the current process is active</returns>

        public bool isActive()
        {
            return active;
        }

        /// <summary>
        /// A method that returns whether the current process is paused
        /// </summary>
        /// <returns>Returns whether the current process is paused</returns>

        public bool isPaused()
        {
            return paused;
        }

        /// <summary>
        /// A method that returns whether the current process is dead
        /// </summary>
        /// <returns>Returns whether the current process is dead</returns>

        public bool isDead()
        {
            return dead;
        }

        public void setDead(bool deadStatus)
        {
            dead = deadStatus;
        }

        /// <summary>
        /// Returns the process to be attached when this process dies, if such a process exists
        /// </summary>
        /// <returns>The next process to be attached to the Process Manager once this process is dead</returns>

        public CProcess getNext()
        {
            return next;
        }

        /// <summary>
        /// Toggles the pause status of the process
        /// </summary>

        public void togglePause()
        {
            paused = !paused;
        }

        /// <summary>
        /// Sets the process to be attached when this process dies
        /// </summary>
        /// <param name="newNext">The new process to be attached when this process dies</param>

        public void setNext(CProcess newNext)
        {
            next = newNext;
        }

        /// <summary>
        /// Virtual method that updates the process
        /// </summary>

        public virtual void VOnUpdate()
        {

        }

        //Data Members

        private bool active;
        private bool paused;
        private bool dead;
        private CProcess next;
    }
}
